home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / objc.795 < prev    next >
Text File  |  1992-02-06  |  2KB  |  59 lines

  1. {\rtf0\ansi{\fonttbl\f2\fnil Times-Roman;\f1\fmodern Courier;}
  2. \paperw12940
  3. \paperh8340
  4. \margl120
  5. \margr1000
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f2\b0\i0\ul0\fs28\fc0 make pswrap and C++ files\
  8. \
  9.  
  10. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 Q:  How do I integrate .psw files with C++ files?  In my Makefile.preamble, I changed the compiler to cc++.  Since 
  11. \b pswrap
  12. \b0  generates 'C' code, the C++ compiler will not work with .c files generated by 
  13. \b pswrap
  14. \b0 .  What can I do?\
  15. \
  16. A:  You need to create a 
  17. \b Makefile.postamble
  18. \b0  and tell 
  19. \b make
  20. \b0  to use 
  21. \b cc
  22. \b0  when compiling pswrap'ed files.  See the example below:  \
  23. \
  24.  
  25. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f1\fs24\fc0     .psw.o:\
  26.         $(PSWRAP) $(PSWFLAGS) -a -h $*.h -o $*.c $*.psw\
  27.         cc $(CFLAGS) -c $*.c -o $(OFILE_DIR)/$*.o\
  28.         rm $*.c\
  29.  
  30. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600         \
  31.  
  32. \f2\fs28 You have to remove the 
  33. \b .c 
  34. \b0 files generated by 
  35. \b pswrap 
  36. \b0 after the compilation, so that in subsequent makes, the 
  37. \b c++ 
  38. \b0 compiler will not try to compile these files.\
  39. \
  40. In general, you can override the default 
  41. \b make 
  42. \b0 rules to suit your environment.  For example, if you only have one C++ file (e.g.  foo.c), add the following to your Makefile.postamble rather than overriding the CC directive in the Makefile.preamble:\
  43. \
  44.  
  45. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f1\fs24\fc0     .c.o:\
  46.         cc++ $(CFLAGS) -c $*.c -o $(OFILE_DIR)/$*.o
  47. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
  48.  
  49. \fc0  \
  50.  
  51. \f2\fs28 See also /usr/lib/nib/Makefile.common for NeXT's default rules, and the NeXTanswer objc.584 for how to integrate C++ and Objective-C files.\
  52. \
  53. QA795\
  54. \
  55. Not Valid for 1.0\
  56. Valid for 2.0\
  57. \
  58.  
  59.